/**
 * @Author YuanYuan
 * @Date 2022/7/16
 * @Time 11:35
 */
public class Sort {

    public void insertSort(int[] array) {
        int i = 0;
        int j = 0;
        int temp = 0;
        for(i = 0;i<array.length;i++) {
            temp = array[i];
            for(j = i-1;j>=0;j--) {
                if(temp<array[j]) {
                    array[j+1] = array[j];
                }else {
                    break;
                }
            }
            array[j+1] = temp;
        }
    }
}
